import yaml

class Conf_Read:
  
  def __init__(self, file_path):
    self.file_path = file_path
    self.conf = None
    self.loadConf()

  def loadConf(self):
    with open(self.file_path, 'r', encoding='utf-8') as file:
      self.conf = yaml.load(file.read(), Loader = yaml.FullLoader)
      return self.conf

  def updateConf(self, newData = None):
    with open(self.file_path, 'w+', encoding='utf-8') as _file:
      if(newData == None):
        newData = self.conf
      
      yaml.dump(newData, _file)